home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Developer Connection Student Program
/
ADC Tools Sampler CD Disk 3 1999.iso
/
Documentation
/
Books
/
Learn Java on the Macintosh
/
Learn Java Projects
/
08.03 - is odd
/
IsOdd.java
< prev
next >
Wrap
Text File
|
1996-04-22
|
652b
|
30 lines
/* -------------------------------------------------------------
This applet illustrates simple flow control.
Java's classes: Applet (applet)
System (lang)
Custom classes: IsOdd
------------------------------------------------------------- */
public class IsOdd extends java.applet.Applet {
public void init() {
int i;
for ( i = 1; i <= 20; i++ ) {
System.out.print( "The number " + i + " is ");
if ( (i % 2) == 0 )
System.out.print( "even" );
else
System.out.print( "odd" );
if ( (i % 3) == 0 )
System.out.print( " and is a multiple of 3" );
System.out.println("");
}
}
}